//package com.nchu.chatserver.config;
//
//import com.nchu.chatserver.controller.WebSocketController;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.socket.config.annotation.EnableWebSocket;
//import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
//import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
//
///**
// * Created with IntelliJ IDEA.
// *
// * @Author: 王小航
// * @Date: 2025/05/07/22:04
// * @Description:
// */
//import org.springframework.context.annotation.Configuration;
//import org.springframework.messaging.simp.config.MessageBrokerRegistry;
//import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
//import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
//import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
//
//@Configuration
//@EnableWebSocketMessageBroker
//public class WebSocketConfig implements WebSocketMessageBrokerConfigurer  {
//
//    @Override
//    public void configureMessageBroker(MessageBrokerRegistry config) {
//        // 配置消息代理，用于处理广播消息
//        config.enableSimpleBroker("/topic");
//        // 配置应用前缀，用于处理应用消息
//        config.setApplicationDestinationPrefixes("/app");
//    }
//
//    @Override
//    public void registerStompEndpoints(StompEndpointRegistry registry) {
//        registry.addEndpoint("/ws")
//                .setAllowedOriginPatterns("*"); // 移除 withSockJS()
//    }
//
//}
//
//
